package ext.tianma.forms.processors;

import java.util.Iterator;
import java.util.List;

import wt.util.WTException;
import wt.vc.Iterated;

import com.ptc.core.components.beans.ObjectBean;
import com.ptc.core.components.forms.FormResult;
import com.ptc.netmarkets.util.beans.NmCommandBean;
import com.ptc.windchill.enterprise.change2.forms.processors.CreateChangeRequestFormProcessor;

public class CusCreateChangeRequestFormProcessor extends CreateChangeRequestFormProcessor{

	@Override
	public FormResult doOperation(NmCommandBean nmcommandBean, List<ObjectBean> list)
			throws WTException {
		FormResult formresult = super.doOperation(nmcommandBean, list);
		Iterator<ObjectBean> iterator = list.iterator();
		
		while (iterator.hasNext()) {
			ObjectBean objbean = iterator.next();
			Object obj =objbean.getObject();
			if( ( obj !=  null ) && ( obj instanceof Iterated ) ){
				Iterated iterated  =( Iterated ) obj;
				
				ChangeNumberUtil.updateChangeItemNumber(iterated);
				
			}
		}
		
		
		return formresult;
	}

}
